package rocketman;
/*
Copyright (C) <year> <name of author>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.util.*;

public class EnemyDuergarWizardShip1 extends Enemy
{
protected int counter = 0;
protected int dd = 10;
public EnemyDuergarWizardShip1(int startx, int starty, String filename, AIengine aiengine)
{
	super(startx, starty, filename,30,aiengine);
	setdy(0);
	setdx(0);
}

public void  move()
{
	if (counter++ > 160) {
		setdy(-5);
		super.move();
		return;
	}
	double d = distance(getx(),40*dd,gety(),dd);
	double r = Math.random();
	if (r >= 0.2) {
		setdx(-1);
	}
	if (r >= 0.4) {
		setdx(1);
	}
	if (r >= 0.6) {
		setdy(-1);
	}
	if (r >= 0.8) {
		setdy(1);
	}
	if (d > 100) {
		if (dx < 0)
			setdx(3);
		else
			setdx(-3);
		if (dy < 0)
			setdy(3);
		else 
			setdy(-3);
	}


	super.move(); 
}

};

